<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFormInstanceTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('form_instance', function (Blueprint $table) {
            $table->bigInteger('id', true)->comment('id');
            $table->bigInteger('data_version_id')->nullable()->index('dvid_idx');
            $table->string('data_version_name', 45)->nullable()->comment('数据版本name');
            $table->string('form_key', 45)->nullable()->index('form_key_idx');
            $table->string('type', 45)->nullable()->index('type_idx');
            $table->bigInteger('owner_id')->nullable();
            $table->string('status', 45)->nullable()->comment('status   INIT/FILL_IN/REVIEW/REVIEW_FAIL/PASS');
            $table->string('comment', 45)->nullable()->comment('备注');
            $table->bigInteger('biz_id')->nullable();
            $table->bigInteger('flow_instance_id')->default(0);
            $table->string('display_mode', 45)->nullable();
            $table->string('minor_version', 45)->nullable();
            $table->timestamps();
            $table->bigInteger('creator_id')->nullable();
            $table->bigInteger('updater_id')->nullable();
            $table->boolean('deleted');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('form_instance');
    }
};
